package cn.ultrarisk.scadmin.manager.biz.common.context;

/**
 * OperationType
 *
 * @author sevendlong(lin23871@163.com)
 * @date 2014/5/27
 * @since V1.0
 */
public enum OperationType {
    //管理员操作类型
    ADMIN_CREATE(1001, "创建管理员【%s】"),
    ADMIN_ENABLE(1002, "启用管理员【%s】"),
    ADMIN_DISABLE(1003, "禁用管理员【%s】"),
    ADMIN_DELETE(1004, "删除管理员【%s】"),
    ADMIN_ALLOCATE(1005, "分配权限给管理员【%s】"),

    //角色操作类型
    ROLE_CREATE(1101, "创建角色【%s】"),
    ROLE_UPDATE(1102, "更新角色【%s】"),
    ROLE_DELETE(1103, "删除角色【%s】"),

    //数据字典操作类型
    DICT_CREATE(1201, "创建数据字典【%s】"),
    DICT_UPDATE(1202, "更新数据字典【%s】"),
    DICT_DELETE(1203, "删除数据字典【%s】"),

    //调度操作类型
    SCHEDULER_CREATE(1301, "创建调度【%s】"),
    SCHEDULER_DISABLE(1302, "启用调度【%s】"),
    SCHEDULER_ENABLE(1303, "禁用调度【%s】"),
    SCHEDULER_SYNC(1304, "同步调度任务"),
    SCHEDULER_UPDATE(1305, "更新调度【%s】"),
    SCHEDULER_DELETE(1306, "删除调度【%s】"),

    //ZK备份操作类型
    ZK_BACKUP_CREATE(1401, "创建ZK备份【%s】"),
    ZK_BACKUP_DELETE(1402, "删除ZK备份【%s】"),

    //构建统计操作类型
    BUILD_HOUR_STAT(1501, "按小时构建统计数据【%s】"),
    BUILD_DAY_STAT(1502, "按天构建统计数据【%s】"),
    BUILD_MONTH_STAT(1503, "按月构建统计数据【%s】"),

    //过期数据删除
    EXPIRED_DATA_DELETE(1601, "删除过期的数据(Solr采集数据、监控数据、S)"),

    //采集操作类型
    GATHER_SOLR(1701, "采集Solr数据"),
    GATHER_ZK(1702, "采集ZK数据"),

    //solr配置文件操作类型
    SOLR_CONFIG_CREATE(1801, "创建配置文件【%s】"),
    SOLR_CONFIG_UPDATE(1802, "更新配置文件【%s】"),
    SOLR_CONFIG_DELETE(1803, "删除配置文件【%s】"),

    //solr集合操作类型
    SOLR_COLLECTION_CREATE(1901, "创建Solr集合【%s】"),
    SOLR_COLLECTION_UPDATE(1902, "更新Solr集合【%s】"),
    SOLR_COLLECTION_RELOAD(1903, "重载Solr集合【%s】"),
    SOLR_COLLECTION_OPTIMIZE(1904, "优化Solr集合【%s】到%s个段"),
    SOLR_COLLECTION_DELETE(1905, "删除Solr集合【%s】"),

    //solr节点操作类型
    SOLR_NODE_DELETE(2001, "删除SOlr节点【%s】"),

    //solr副本操作类型
    SOLR_REPLICA_CREATE(2001, "创建Solr副本【%s】"),
    SOLR_REPLICA_DELETE(2002, "删除Solr副本【%s】"),

    //索引操作类型
    SOLR_DATA_UPDATE(2101, "更新索引数据【%s】"),
    SOLR_DATA_DELETE(2102, "删除索引数据【%s】");

    private Integer value;
    private String remark;
    OperationType(Integer value, String remark) {
        this.value = value;
        this.remark = remark;
    }

    public Integer value() {
        return this.value;
    }

    public String remark(Object... args) {
        if (args != null && args.length > 0) {
            return String.format(this.remark, args);
        }
        return this.remark;
    }
}
